function [ Px,w ] = pcorr( x,p )
%PCORR Summary of this function goes here
%   Detailed explanation goes here
[N M] = size(x);
xn = [x;zeros(p,1)];
A_Np = zeros(p,N);
for k = 1:p
    A_Np(k,k+1:k+N) = x';
end

a = (A_Np*A_Np'/(N+p))^(-1)*(A_Np*xn/(N+p));
w = (0.001:0.001:pi);
k = (1:p)';
Px = 1./(abs(1+a'*exp(-j*2*pi*k*w)).^2);
end

